<?php get_header(); ?>
<div class="row-fluid">
	<div class="span3">
		<?php get_sidebar() ?>
	</div>
	<div class="span9">
		<div class="row-fluid">
			<?php 
				$settings = get_option('dp_shopping_cart_settings');
				if ( have_posts() ) : 
					the_post();
					$fields = get_post_custom($product->ID);
					$output = dpsc_get_product_details(get_the_ID(), $p_b_n, $direct_checkout, $affiliate_checkout);
					$attachment_images = &get_children('post_type=attachment&post_status=inherit&post_mime_type=image&post_parent=' . get_the_ID());
					if (is_array($attachment_images) && count($attachment_images) != 0) {
			?>
						<div class="span6">
							<div class="row-fluid dpsc_image_section">
								<div class="span3 visible-desktop dpsc_image_tab">
									<ul class="unstyled dpsc_tabs">
									<?php 
										$count = 0;
										foreach ($attachment_images as $image) { 
											if ($count == 0) {
												$big = $image;
												$count++;
											}
									?>
										<li class="">
											<a href="<?php echo $image->guid; ?>" class="dpsc_thumb_tab thumbnail" id="<?php get_the_ID(); ?>">
												<img src="<?php echo DP_PLUGIN_URL . '/lib/timthumb.php?src=' . $image->guid . ''; ?>" />
											</a>
										</li>
									<?php } ?>
									</ul>
								</div>
								<div class="span9 dpsc_main_image main_">
									<a href="<?php echo $big->guid; ?>" title="image" class="dp_jqzoom thumbnail">
										<img src="<?php echo DP_PLUGIN_URL . '/lib/timthumb.php?src=' . $big->guid . '&w=' . $settings['m_w'] . '&h=' . $settings['m_h'] . '&zc=1' ?>" />
									</a>
								</div>
							</div>
						</div>
				<?php } ?>
				<div class="span6 product-detail">
					<h3 class="prd-title"><?php the_title()?></h3>
					<ul class="unstyled ">
						<li class="row-fluid">
							<span class="span3 prd-fields">Mã số:</span>
							<span class="span9 prd-value prd-id"><?php echo $fields['pid'][0]; ?></span>
						</li>
						<li class="row-fluid">
							<span class="span3 prd-fields">Giá:</span>
							<span class="span9 prd-value prd-price"><?php echo number_format($fields['price'][0]) . ' ' . $settings['dp_currency_symbol']; ?></span>
						</li>
						<li class="row-fluid">
							<span class="span3 prd-fields">Tình trạng:</span>
							<span class="span9 prd-value prd-status">
								<?php 
									$stock = isset($fields['currently_in_stock'][0]) ? $fields['currently_in_stock'][0] : null;
									if ($stock == null || $stock != 0)
										echo 'Còn hàng';
									else
										echo 'Hết hàng'; 
								?>
							</span>
						</li>
						<li class="row-fluid fb-block">
							<div class="span12">
								<div class="fb-like" data-href="<?php the_permalink(); ?>" data-send="true" data-width="300" data-show-faces="true"></div>
							</div>
						</li>
					</ul>
				</div>
			<?php endif; ?>
		</div>
		<div class="ctn-detail">
			<ul class="nav nav-tabs">
				<li><a href="#home" data-toggle="tab">Thông tin chi tiết</a></li>
			</ul>
			<div class="tab-content">
				<div class="tab-pane active" id="home">
					<?php the_content(); ?>
				</div>
			</div>
		</div>
	</div>
	
</div>

<?php get_footer(); ?>
